package com.xcity.pomelo.request;

import com.alibaba.fastjson.annotation.JSONField;
import com.xcity.game.account.AccountChannel;
import com.xcity.game.account.Platform;
import com.xcity.pomelo.PomeloRoute;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.PomeloPacket;

@PomeloMessage(route = PomeloRoute.REGISTER)
public class RegisterRequest extends PomeloPacket {

	@JSONField(name = "username")
	private String userName;
	private String userId; // @see User#channelUid
	@Deprecated
	private String ip;
	private String channel;
	private int platform; // 1: Android, 2: IOS
	private String token;
	
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserId() {
		return userId;
	}
	
	public String getWrappedUserId() {
		return AccountChannel.forCode(channel).withPrefix(userId, getPlatform());
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Deprecated
	public String getIp() {
		return ip;
	}

	@Deprecated
	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getChannel() {
		return channel;
	}

	public void setChannel(String channel) {
		this.channel = channel;
	}

	public Platform getPlatform() {
		return Platform.forCode(platform);
	}

	public void setPlatform(int platform) {
		this.platform = platform;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

}
